<?php

namespace app\index\model\tan;

use think\Model;
/**
 * 消费记录log
 */
class CardBalanceLog extends Model
{
    
    /**
     * 显示搜索
     * @param array $search
     * @param int   $id     userid
     * @return type
     */

    public function SearchShow($search,$id){
        $where=[
            "user_id"=>$id,
        ];
        if(! empty($search['startdate'])){
            $where["createtime"] =[">=",$search['startdate']] ;
        }
        if(! empty($search['enddate'])){
            $where["createtime "] =["<=",$search['enddate']] ;
        }
        return $this->where($where) ->order("id desc") ->paginate();
    }
    /**
     * 
     * @param type $bool 是否成功，成功
     */
    public function insert_($bool){
        $this->transaction(function() use ($bool){
            if($bool == true){
                
            }
        });
    }
}
